package cn.edu.zsc.blms.service.array;

import cn.edu.zsc.blms.App;
import cn.edu.zsc.blms.domain.BaseEntity;

public abstract class BaseService {

    protected final BaseEntity[]DATA=new BaseEntity[100];

    protected int getInputId(){
        if(!App.input.hasNextInt()){
            App.input.nextLine();
            System.out.println("ID为整数，请输入整数值");
            return -1;
        }
        int id=App.input.nextInt();
        App.input.nextLine();
        if(id>= DATA.length || DATA[id]==null){
            System.out.println("不存在该ID的数据");
            return -1;
        }
        return id;
    }
}
